<template>
  <div class="tab-comp">
    <van-tabs
      type="card"
      title-active-color="#3E77FA"
      title-inactive-color="#616366"
      background="#F3F5F9"
      :swipeable="true"
      :ellipsis="false"
      @change="changeTab"
      v-model:active="active"
    >
      <van-tab
        :title="item"
        v-for="(item, idx) in tabList"
        :key="item"
        :name="idx + 1"
      ></van-tab>
    </van-tabs>
  </div>
</template>

<script setup lang="ts">
import { ref } from "vue";

const props = defineProps({
  tabList: Array,
  tabActive: Number,
});
console.log('props', props);
const active = ref(props.tabActive)
const emit = defineEmits(["changeOptionTab"]);
const changeTab = (idx: Number) => {
  emit("changeOptionTab", idx);
};
</script>

<style lang="less" scoped>
.tab-comp {
  /deep/ .van-tabs__nav {
    padding: 3px;
  }
  /deep/ .van-tabs__nav--card {
    border: none;
    border-radius: 6px;
    margin: 0;
  }
  /deep/ .van-tab--card {
    border-right: none;
  }
  /deep/ .van-tab--card.van-tab--active {
    background: #fff;
    border-radius: 6px;
  }
}
</style>
